package com.sneakxy.mybase4j.platform.beans;

import java.util.List;

import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotBlank;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;

import com.sneakxy.mybase4j.base.bean.BaseEntity;
import com.sneakxy.mybase4j.base.bean.ValidAdd;
import com.sneakxy.mybase4j.base.bean.ValidEdit;
import com.sneakxy.mybatis.commons.annotations.Column;
import com.sneakxy.mybatis.commons.annotations.Table;
import com.sneakxy.mybatis.commons.orm.generation.GeneratedValue;
import com.sneakxy.mybatis.commons.orm.generation.GenerationType;

/**
 * 
 * @author 潜行的青衣
 * @see
 */
@Table("t_mb4j_dict")
public class Dict extends BaseEntity<String> {

	private final static long serialVersionUID = -1L;

	@Id
	@Column("id")
	@GeneratedValue(strategy = GenerationType.UUID)
	@NotBlank(groups={ValidEdit.class})
	@Size(max=32, groups={ValidEdit.class})
	private String id;

	@Column("label")
	@NotBlank
	@Size(max=50, groups={ValidAdd.class, ValidEdit.class})
	private String label;

	@Column("memo")
	@Size(max=100, groups={ValidAdd.class, ValidEdit.class})
	private String memo;

	@Column("parent_id")
	private String parentId;

	@Column("sort")
	private Integer sort;

	@Column("value")
	@NotBlank
	@Size(max=100, groups={ValidAdd.class, ValidEdit.class})
	private String value;
	
	@Transient
	private List<Dict> children;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	/**
	 * @return the children
	 */
	public List<Dict> getChildren() {
		return children;
	}

	/**
	 * @param children the children to set
	 */
	public void setChildren(List<Dict> children) {
		this.children = children;
	}

}
